<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>
				<div class="row">

					<form class="form-inline" action="" style=" padding: 0px 5px; float:left" method="get">

						<label class="inline">供应产品搜索</label>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<label class="inline">供应商家ID</label>
						<input type="text" name="customer_id" value="{$Think.get.customer_id}" class="form-control" size="20">
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<label class="inline">商品ID</label>
						<input type="text" name="goods_id" value="{$Think.get.goods_id}" size="20" class="form-control">
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						审核状态：
						<div class="form-group">
							<select name="status">    
								<option value="0" <eq name="Think.get.status" value="0">selected</eq>>未审核</option>    
								<option value="1" <eq name="Think.get.status" value="1">selected</eq>>审核未通过</option>   
								<option value="2" <eq name="Think.get.status" value="2">selected</eq>>审核通过</option>                         
							</select>
						</div>
						<button type="submit" class="btn btn-purple btn-sm">
							<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
							Search
						</button>
					</form>
				</div>
				<div class="space-4"></div>
				<div class="row" style="">
					<div class="col-sm-12">
						<div class="infobox infobox-pink">
							<div class="infobox-icon">
								<i class="ace-icon fa fa-shopping-cart"></i>
							</div>

							<div class="infobox-data">
								<span class="infobox-data-number">{$total}</span>
								<div class="infobox-content">供应总数</div>
							</div>
						</div>
						<div class="infobox infobox-pink">
							<div class="infobox-icon">
								<i class="ace-icon fa fa-shopping-cart"></i>
							</div>

							<div class="infobox-data">
								<span class="infobox-data-number">{$yes_total}</span>
								<div class="infobox-content">审核总数</div>
							</div>
						</div>
						<div class="infobox infobox-pink">
							<div class="infobox-icon">
								<i class="ace-icon fa fa-shopping-cart"></i>
							</div>
							<div class="infobox-data">
								<span class="infobox-data-number">{$no_total}</span>
								<div class="infobox-content">未审核总数</div>
							</div>
						</div>
						<div class="infobox infobox-pink">
							<div class="infobox-icon">
								<i class="ace-icon fa fa-shopping-cart"></i>
							</div>

							<div class="infobox-data">
								<span class="infobox-data-number">{$w_total}</span>
								<div class="infobox-content">未通过总数</div>
							</div>
						</div>
					</div>
				</div>
                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="space-4"></div>
                        <div class="row">
                            <form id="form" method="post" action="{:U('del')}">
                                <table class="table table-striped table-bordered table-hover" id="simple-table">
                                    <thead>
                                    <tr>
										<th class="center"><input class="check-all" type="checkbox" value=""></th>
                                        <th>供货产品ID</th>
                                        <th>供货商名称</th>
                                        <th>商品名称</th>
                                        <th>一件代发价</th>
                                        <th>锁货价</th>
                                        <th>最低锁货量</th>
                                        <th>批发价</th>
                                        <th>最低批发量</th>
                                        <th>库存</th>
                                        <th>状态</th>
                                        <eq name="Think.get.status" value="1"><th>未通过原因</th></eq>
                                        <th class="center">供货时间</th>
                                        <th class="center">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <volist name="list" id="val">
                                        <tr>
											<td class="center">
                                               <input class="ids" type="checkbox" value="{$val['id']}">
                                            </td>
                                            <td>{$val['id']}</td>
                                            <td>{$val.shop_name}</td>
                                            <td>{$val['name']}</td>
                                            <td>{$val['acting_price']}</td>
                                            <td>{$val['lock_price']}</td>
                                            <td>{$val['lock_start_num']}</td>
                                            <td>{$val['acting_price']}</td>
                                            <td>{$val['acting_price']}</td>
                                            <td>{$val.stock_num}</td>
                                            <td>
												<switch name="val.status">
													<case value="0">未审核</case>
													<case value="1"><span style="color:red">审核未通过</span></case>
													<case value="2"><span style="color:green">审核通过</span></case>
												</switch>
											</td>
                                        	<eq name="Think.get.status" value="1"><td>{$val.note}</td></eq>
                                            <td class="center">{:date('Y-m-d',$val['create_time'])}</td>
                                        
                                            <td class="center">
                                                <eq name="val.status" value="2">--<else/><a href="javascript:;" id="shenhe" data-id="{$val.id}">审核</a></eq>
                                            </td>
                                        </tr>
                                    </volist>
                                    </tbody>
                                </table>
                            </form>
                        </div>
						<div class="cf">
							<input id="submit_sh" class="btn btn-info" type="button" value="一键审核通过">
						</div>
						{$page}
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
		<style>
			.tk_div_info{ width:500px; height:280px; border:1px solid #ccc; position:fixed; background:#fff; top:30%; left:50%; margin-left:-249px; -webkit-box-shadow: #666 0px 0px 10px; -moz-box-shadow: #666 0px 0px 10px; box-shadow: #666 0px 0px 10px;behavior: url(/PIE.htc); display:none;}
			.tk_div_info dl{ margin:20px;display:block; }
			.tk_div_info dl dt{ width:100%; border-bottom:1px dashed #ccc; height:40px; line-height:40px; font-size:16px; margin-bottom:20px;}
			.tk_div_info dl dd{ width:100%; margin-bottom:10px;}
			.tk_div_info dl dd label{ width:120px; display: inline-block; }
			textarea[disabled]{ background:#efefef}
		</style>
    </div><!-- /.main-content -->
	<div class="tk_div_info">
		<dl>
        	<dt>供应信息审核<a href="javascript:;" onclick="$('.tk_div_info').hide();" style=" position:absolute; width:20px; height:20px; line-height:20px; text-align:center; margin:-10px 0px 0px 350px; color:#fff; background:#666; display:inline-block; font-size:16px;">×</a></dt>
            <dd><label>审核类型：</label><select id="shen_status" style="vertical-align:middle"><option value="2">审核通过</option><option value="1">不通过审核</option></select></dd>
            <dd><label>不通过原因：</label><textarea id="note" disabled style="vertical-align:middle; width:220px; height:60px;"></textarea></dd>
            <dd style=" margin-top:20px;"><label>&nbsp;</label><button type="button" style=" padding:8px 20px; border:none; background:#6fb3e0; color:#fff;" id="shenhe_but">确认操作</button></dd>
        </dl>
	</div>
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
	$('a#shenhe').click(function(){
		var _self = $('.tk_div_info');
		_self.find('textarea').val('').attr('disabled' , true);
		_self.find('select option:selected').attr( 'selected' , false );
		_self.find('select option').eq(0).attr( 'selected' , true );
		_self.find('button').attr('data-id' , $(this).attr('data-id'));
		_self.show();
	});
	$('#shen_status').change(function(){
		if( $(this).val() == 1 ) {
			$('.tk_div_info').find('textarea').val('').attr('disabled' , false);
		} else {
			$('.tk_div_info').find('textarea').val('').attr('disabled' , true);	
		}
	});
	$(document).on('click' , '#shenhe_but' , function(){
		var id = $(this).attr('data-id');
		var note = $('#note').val();
		var status = $('#shen_status').val();
		if( status == 1 && note == '' ) {
			swal('请输入审核不通过的原因' , '' , 'error');
			return false;	
		}
		$.get('{:U('productStatus')}' , { id : id , status : status, note:note } , function(data){
			swal( data.info , '' , ( data.status == 1 ? 'success' : 'error' ) );
			setTimeout(function(){ location.reload(); } , 1500);
		},'json');
	});
	$('#submit_sh').click(function(){
		var _self = $('input.ids:checked');
		if( _self.length <= 0 ) {
			swal('请勾选要审核的数据' , '' , 'error');
			return false;
		}
		var ids = '';
		_self.each(function(){ ids+=','+$(this).val(); });
		$.get('{:U('productStatus')}' , { id : ids.substr(1) , status : 2 } , function(data){
			swal( data.info , '' , ( data.status == 1 ? 'success' : 'error' ) );
			setTimeout(function(){ location.reload(); } , 1500);
		},'json');
	});
	$(".check-all").click(function () {
		$(".ids").prop("checked", this.checked);
	});
</script>
</body>
</html>
